// validate
var checklist = {
  finCarInvoicePrice: {
    number: true
  },
  finDownPayment: {
    number: true,
    numberMinCheck: [0.00],
    numberMaxCheck: [9999999.99]
  },
  indCustomerName: {
    required: true,
    checkName: true,
    checkPersonName: true
  }
}

function saveCheck (formdata) {
  for (var dataname in formdata) {
    console.log(dataname + ':' + formdata[dataname])
  }
  for (var chk in checklist) {
    console.log(chk + '|' + checklist[chk].numberMinCheck)
  }
  return true
}

function submitCheck (formdata) {

}

const custValid = function (event, err) {
  var ele = event.target
  var val = ele.value
  var pat = event.target.pattern
  var regex = new RegExp(pat)
  console.log(val)
  console.log(regex.test(val))
  if (val !== '' && !regex.test(val)) {
    ele.setCustomValidity(err)

    ele.focus()
  }
}

const test = function () {
  alert('test')
}

export default {custValid, test, saveCheck, submitCheck, checklist}
